<!DOCTYPE html>
<html>
<head>
<title></title> <@h.head />

<style type="text/css">
body {
	padding-bottom: 40px;
}

.sidebar-nav {
	padding: 9px 0;
}

@media ( max-width : 980px) {
	/* Enable use of floated navbar text */
	.navbar-text.pull-right {
		float: none;
		padding-left: 5px;
		padding-right: 5px;
	}
}
</style>
</head>
<body>
	<form action="${path}/role/savePerm" method="post" class="definewidth m20">
		<input type="hidden" name="id" value="${id!''}" />
		<table class="table table-bordered table-hover definewidth m10">
			<tr>
				<td class="tableleft">权限</td>
				<td>
				<ul>
					<#if list?exists>
						<#list list as r>
							<#if r.pid==0>
							<li>
							<label class='checkbox inline'><input
								type='checkbox' name='rid' value='${(r.id)!""}'
								${(r.checked)!""}
								 />${r.name}</label>
							<ul>
							<#list list as rr>
								<#if rr.pid==r.id>
								<li><label class='checkbox inline'><input
										type='checkbox' name='rid' value='${(rr.id)!""}' ${(rr.checked)!""} />${rr.name}</label>
										<ul>
										<#list list as rrr>
											<#if rrr.pid==rr.id>
											<li>
												<label class='checkbox inline'><input
													type='checkbox' name='rid' value='${(rrr.id)!""}' ${(rrr.checked)!""} />${rrr.name}</label>
											</li>
											</#if>
										</#list>
										</ul>
								</#if>
							</#list>
							</ul>
							</li>
							</#if>
						</#list>
					</#if>
					</ul></td>
			</tr>
			<tr>
				<td class="tableleft"></td>
				<td>
					<button type="submit" class="btn btn-primary" type="button">保存</button>
					&nbsp;&nbsp;
					<button type="button" class="btn btn-success"
						id="backid" onclick="javascript:history.go(-1)">返回列表</button>
				</td>
			</tr>
		</table>
	</form>
	<@h.foot />
	<script>
		$(function() {
			$(':checkbox[name="rid"]').click(
					function() {
						$(':checkbox', $(this).closest('li')).prop('checked',
								this.checked);
					});
		});
	</script>
</body>
</html>
